{include file='public/head'}

<style type="text/css" media="screen">
    header {
        color: black;
    }
    .x-body {
        min-width: 500px;
    }

    body {
        overflow-x: scroll;
    }
</style>
<body>
<div class="x-body">
    <form class="layui-form" id='mainForm' method="post" action="fanyi">
        <table class="layui-table">
            <thead>
            <tr>
                <td style="width: 70px;">翻译字段</td>
                <td>翻译内容</td>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>产品名称</td>
                <td>{$productInfo.proname}</td>
            </tr>
            <tr>
                <td>产品卖点</td>
                <td><textarea class="layui-textarea" readonly>{$productInfo.sketch}</textarea></td>
            </tr>
            <tr>
                <td>关键词</td>
                <td><textarea class="layui-textarea" readonly>{$productInfo.keywords}</textarea></td>
            </tr>
            <tr>
                <td>产品描述</td>
                <td><textarea class="layui-textarea" readonly>{$productInfo.content}</textarea></td>
            </tr>
            <tr>
                <td><b style="color:red">*</b><b style="color: #1E9FFF">目标语言</b></td>
                <td>{volist name="lang" id="vo"}
                    <input type="checkbox" id="langs" name="langs[]" title="{$vo.lang}" value="{$vo.lanid}" lay-skin="primary">
                    {/volist}
                </td>
            </tr>
            </tbody>
        </table>

        <input type="hidden" name="id" id="id" value="{$Think.get.id}">
        <input type="hidden" name="lang" id="lang" value="{$Think.get.lang}">

        <div class="layui-form-item">
            <div>
                <button style="width: 100%" class="layui-btn" lay-submit="" lay-filter="toSubmit">提交保存</button>
            </div>
        </div>

    </form>
</div>
</body>
{include file='public/foot'}
<script type="text/javascript">
    var form = layui.form;
    var layer = layui.layer;

    //监听提交
    form.on('submit(demo1)', function (data) {
        layer.alert(JSON.stringify(data.field), {
            title: '最终的提交信息'
        })
        return false;
    });

    $(document).ready(function () {
        var options = {
            type: 'post',           //post提交
            dataType: "json",        //json格式
            data: {},    //如果需要提交附加参数，视情况添加
            clearForm: false,        //成功提交后，清除所有表单元素的值
            resetForm: false,        //成功提交后，重置所有表单元素的值
            cache: false,
            async: false,          //同步返回
            success: function (data) {
                console.log(data);
                if (data.code == 0) {
                    layer.msg(data.msg);
                } else {
                    layer.msg(data.msg, {icon: 1, time: 500}, function () {
                        $("#reset").click();
                        x_admin_close();
                        parent.location.reload();
                    });
                }
                //服务器端返回处理逻辑
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                layer.msg('操作失败:服务器处理失败');
            }
        };
        // bind form using 'ajaxForm'
        $('#mainForm').ajaxForm(options).submit(function (data) {
            //无逻辑
        });
        form.render();
    });

</script>
